package com.cleaningcloud.erp.service.impl;

import java.util.List;
import com.cleaningcloud.common.core.utils.DateUtils;
import com.cleaningcloud.common.core.utils.UniqueIdUtils;
import com.cleaningcloud.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.cleaningcloud.erp.mapper.ErpSupplierMapper;
import com.cleaningcloud.erp.domain.ErpSupplier;
import com.cleaningcloud.erp.service.IErpSupplierService;

/**
 * 供应商管理Service业务层处理
 * 
 * @author cleaningcloud
 * @date 2024-09-25
 */
@Service
public class ErpSupplierServiceImpl implements IErpSupplierService 
{
    @Autowired
    private ErpSupplierMapper erpSupplierMapper;

    /**
     * 查询供应商管理
     * 
     * @param supplierId 供应商管理主键
     * @return 供应商管理
     */
    @Override
    public ErpSupplier selectErpSupplierBySupplierId(Long supplierId)
    {
        return erpSupplierMapper.selectErpSupplierBySupplierId(supplierId);
    }

    /**
     * 查询供应商管理列表
     * 
     * @param erpSupplier 供应商管理
     * @return 供应商管理
     */
    @Override
    public List<ErpSupplier> selectErpSupplierList(ErpSupplier erpSupplier)
    {
        return erpSupplierMapper.selectErpSupplierList(erpSupplier);
    }

    /**
     * 新增供应商管理
     * 
     * @param erpSupplier 供应商管理
     * @return 结果
     */
    @Override
    public int insertErpSupplier(ErpSupplier erpSupplier)
    {
        erpSupplier.setCreateTime(DateUtils.getNowDate());
        erpSupplier.setCreateId(SecurityUtils.getUserId());
        erpSupplier.setCreateName(SecurityUtils.getUsername());
        erpSupplier.setSupplierNo("GY" + UniqueIdUtils.generateUniqueId());
        erpSupplier.setFlag("Y");
        return erpSupplierMapper.insertErpSupplier(erpSupplier);
    }

    /**
     * 修改供应商管理
     * 
     * @param erpSupplier 供应商管理
     * @return 结果
     */
    @Override
    public int updateErpSupplier(ErpSupplier erpSupplier)
    {
        return erpSupplierMapper.updateErpSupplier(erpSupplier);
    }

    /**
     * 批量删除供应商管理
     * 
     * @param supplierIds 需要删除的供应商管理主键
     * @return 结果
     */
    @Override
    public int deleteErpSupplierBySupplierIds(Long[] supplierIds)
    {
        return erpSupplierMapper.deleteErpSupplierBySupplierIds(supplierIds);
    }

    /**
     * 删除供应商管理信息
     * 
     * @param supplierId 供应商管理主键
     * @return 结果
     */
    @Override
    public int deleteErpSupplierBySupplierId(Long supplierId)
    {
        return erpSupplierMapper.deleteErpSupplierBySupplierId(supplierId);
    }

    @Override
    public int getAutoIncrement() {
        return erpSupplierMapper.getAutoIncrement();
    }

    @Override
    public List<ErpSupplier> getList() {
        return erpSupplierMapper.getList();
    }
}
